package com.scorpios.springbootdemo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class IndexController {

    @RequestMapping("/index")
    @ResponseBody
    public String sayHello(){
        System.out.println("hello ...");
        return "hello";
    }

    @RequestMapping("/test")
    @ResponseBody
    public Map test(String token,Long id){
        System.out.println("hello ...");
        Map map = new HashMap();
        map.put("token", token);
        map.put("id", id);
        System.out.println("getHeader ...");
        return map;
    }
    @RequestMapping("/getHeader")
    @ResponseBody
    public Map getHeader(@RequestHeader("token")String token, Long id){
        Map map = new HashMap();
        map.put("token", token);
        map.put("id", id);
        System.out.println("getHeader ...");
        return map;
    }
}
